Skip to content

Conversation

@sarah11918
Copy link
Member

@sarah11918 sarah11918 commented Sep 22, 2025

This adds "Removed: content collections" to the v6 upgrade guide

Direct deploy preview: https://deploy-preview-12376--astro-docs-2.netlify.app/en/guides/upgrade-to/v6/#removed-legacy-content-collections

Implementation PR #14407

This PR should include

  • Upgrade guide content for removal
  • Remove legacy flag docs
  • placeholder error messages so that links will work (both to them, and allow us to check links in them, if necessary)
    • the content here doesn't have to be 100% accurate -- it will be overwritten with the JSDoc eventually
    • I did not (yet?) bother to add these to the error index page as that will also be autogenerated and isn't needed for resolving or checking links
  • Check whether there are error messages for (then add to the details/summaries):
    • NOT having any content config file at all
    • calling entry.render()

Follow-up/concurrent tasks:

  • Proper error messages made at the source

Notes:

  • there should not be any new astro:content reference updated needed: v5 already only documents the newest API
  • any guide/reference changes will be handled along with Live Collections becoming stabilized (which will probably affect how we describe collections in general, and will bring larger docs needs around collections and API reference)
    • let's not refer to "Content Layer API" anymore: going forward, we will have "collections" and "live collections"

@netlify
Copy link

netlify bot commented Sep 22, 2025

Deploy Preview for astro-docs-2 ready!

Name Link
🔨 Latest commit 7f20e74
🔍 Latest deploy log https://app.netlify.com/projects/astro-docs-2/deploys/68f6031ff7e363000875e64d
😎 Deploy Preview https://deploy-preview-12376--astro-docs-2.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@astrobot-houston
Copy link
Contributor

astrobot-houston commented Sep 22, 2025

Lunaria Status Overview

🌕 This pull request will trigger status changes.

Learn more

By default, every PR changing files present in the Lunaria configuration's files property will be considered and trigger status changes accordingly.

You can change this by adding one of the keywords present in the ignoreKeywords property in your Lunaria configuration file in the PR's title (ignoring all files) or by including a tracker directive in the merged commit's description.

Tracked Files

File Note
en/guides/upgrade-to/v6.mdx Source changed, localizations will be marked as outdated.
en/reference/errors/content-collection-invalid-type.mdx Localization added, will be marked as complete.
en/reference/errors/content-collection-missing-loader.mdx Localization added, will be marked as complete.
en/reference/errors/legacy-content-config-error.mdx Localization added, will be marked as complete.
en/reference/legacy-flags.mdx Source changed, localizations will be marked as outdated.
Warnings reference
Icon Description
🔄️ The source for this localization has been updated since the creation of this pull request, make sure all changes in the source have been applied.

@sarah11918 sarah11918 added the 6.0 label Sep 22, 2025
@sarah11918 sarah11918 added this to the v6.0.0 docs milestone Sep 22, 2025
@sarah11918 sarah11918 changed the title Content collections removed support for legacy content collections removed Sep 24, 2025

If you have content collections errors after upgrading to v6, use the following list to help you identify and upgrade any legacy features that may exist in your code.

##### If you have...
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should add the error messages in here too

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this could be helpful, or at least the error code so someone can easily identify the details to expand.

Copy link
Member Author

@sarah11918 sarah11918 Sep 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great idea! Would the implementation PR be a comprehensive list of all the ones they might encounter?

I'm seeing:

  • 'LegacyContentConfigError'
  • 'ContentCollectionMissingLoader'
  • 'ContentCollectionInvalidType'

What we did for v5 was mock up the new errors / config in the v5 branch (duplicating what would be generated from the JSDoc), so we should probabably manually recreate those errors in this PR, too. If they end up not being identical, then a ci PR will be generated to align them.

Just copied the entire jsdoc from entries here for now
  • @docs
  • @message
  • Example error message:
  • Found legacy content config file in "src/content/config.ts". Please move this file to "src/content.config.ts" and ensure each collection has a loader defined.
  • @description
  • A legacy content config file was found. Move the file to src/content.config.ts and update any collection definitions if needed.
  • See the Astro 6 migration guide for more information.
    */

export const LegacyContentConfigError = {
name: 'LegacyContentConfigError',
title: 'Legacy content config file found.',
message: (filename: string) =>
Found legacy content config file in "${filename}". Please move this file to "src/content.config.${filename.split('.').at(-1)}" and ensure each collection has a loader defined.,
hint: 'See https://docs.astro.build/en/guides/upgrade-to/v6/#removed-legacy-content-collections for more information on updating collections.',
} satisfies ErrorData;

/**

  • @docs
  • @message
  • Example error message:
  • Collections must have a loader defined. Check your collection definitions in your content config file.
  • @description
  • A content collection is missing a loader definition. Make sure that each collection in your content config file has a loader.
  • See the Content collections documentation for more information.
    */

export const ContentCollectionMissingLoader = {
name: 'ContentCollectionMissingLoader',
title: 'Content collection is missing a loader definition.',
message: (file = 'your content config file') =>
Collections must have a \loader` defined. Check your collection definitions in ${file}.`,
hint: 'See https://docs.astro.build/en/guides/content-collections/ for more information on content loaders and https://docs.astro.build/en/guides/upgrade-to/v6/#removed-legacy-content-collections for more information on migrating from legacy collections.',
} satisfies ErrorData;

/**

  • @docs
  • @message
  • Example error message:
  • Invalid collection type "data". Remove the type from your collection definition in your content config file.
  • @description
  • Content collections should no longer have a type field. Remove this field from your content config file.
  • See the Astro 6 migration guide for more information.
    */

export const ContentCollectionInvalidType = {
name: 'ContentCollectionInvalidType',
title: 'Content collection has an invalid type field.',
message: (type: string, file = 'your content config file') =>
Invalid collection type "${type}". Remove the type from your collection definition in ${file}.,
hint: 'See https://docs.astro.build/en/guides/upgrade-to/v6/#removed-legacy-content-collections for more information on migrating from legacy collections.',
} satisfies ErrorData;

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are also some places where we just log a warning rather than throwing an error:

https://github.com/withastro/astro/pull/14407/files#diff-04e44d3cde1db4d52d43a7732043f5239e1c49479b993e3dda7486399a5a51fbR214-R223

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could add a more searchable name there too.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't get to the spot in that link directly from the link, because GitHub can't handle the PR. 😅 Which file are warnings included in so I can get there myself?

Copy link
Member Author

@sarah11918 sarah11918 Sep 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, I've updated the text to refer to both error messages and warnings and we can do further edits on top of that!

I'm not sure they all need to be spelled out here, since in theory those should have their own explanations and guidance. To avoid this content being overwhelming, I think just a mention that "if you get warnings/errors, these are the likely places to check" is fine here! If people are not getting these errors/warnings, no need to be spelling them out.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just meant adding the specific codes such as ContentCollectionMissingLoader to the section, to make each section more searchable

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I think I get it. Let me cook!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, here's my current draft to address this:

image

@ascorbic I didn't notice specific errors (either in your removing legacy support PR, nor existing ones) for the situation where:

  • there is NO content config file at all
  • they are not importing and using the render function (and are instead calling it on the entry)

So, those two don't have associated errors mentioned here. Do we have such errors, and if not, should we?

Copy link
Member

@ArmandPhilippot ArmandPhilippot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A small nit, otherwise I think this format looks great and makes sense!

@sarah11918
Copy link
Member Author

Made some changes and resolved some conversations with explanations not to shut down further editing, just to tidy up and so we can work from something fresh now!

@sarah11918 sarah11918 marked this pull request as ready for review September 26, 2025 13:12
@sarah11918
Copy link
Member Author

sarah11918 commented Oct 17, 2025

I think all the pieces are here, and I did some minor polishing. Time to review again! Note that there ARE error messages in the astro repo errors.ts file, and these somewhat mirror them. We can deal with any slight discrepancies when we merge that branch into this branch.

NB: as noted above, any updating of the actual content collections guide page itself will come with the stabilization of Live Collections. Since non-legacy (current, non-live) collections are the main game in town, our current content collections page needs no updating to correspond to the loss of legacy collections.

Copy link
Member

@ArmandPhilippot ArmandPhilippot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, I left a few comments but those are mostly nitpicks!

@sarah11918
Copy link
Member Author

sarah11918 commented Oct 20, 2025

Going to consider this one acceptable enough to merge! I searched, but couldn't find any related error messages to not having a config file, nor using the older render method, so I think otherwise, this is good to go!

Still lots of time to make updates if we notice them, but this way, this content is merged and we can link to it in the preview of the upgrade guide.

@sarah11918 sarah11918 merged commit ab8cf68 into v6 Oct 20, 2025
10 checks passed
@sarah11918 sarah11918 deleted the content-collections-removed branch October 20, 2025 09:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants